import { View, Text, Image } from '@tarojs/components'
import Taro, { useLoad } from '@tarojs/taro'
import BasicLayout from '@/layout'
import { Avatar, Divider, Space } from '@nutui/nutui-react-taro'
import TodoList from './components/TodoList'
import TaskList from './components/TaskList'
import AbilityImg from '@/assets/images/ability.png'
import MessageImg from '@/assets/images/message.png'

import './index.less'
import { useState } from 'react'




export default function Index() {
  const [navBarHeight, setNavBarHeight] = useState(0)
  useLoad(() => {
    console.log('Page loaded.', Taro.getSystemInfo())
    // Taro.switchTab({
    //   url: '/pages/sampling/index'
    // })
    getStatusBarHeight()
  })
  console.log(112233, navBarHeight)
  async function getStatusBarHeight() {
    const { statusBarHeight = 0 } = await Taro.getSystemInfo()
    setNavBarHeight(statusBarHeight)
  }

  return (
    <View className='homeWrapper'>
      <BasicLayout>
        <View className='contentPersonel' style={{ paddingTop: `${72 + navBarHeight}px` }}>
          <View className='personelInfo'>
            <View className='header'>
              <Avatar
                size='large'
                src='https://img12.360buyimg.com/imagetools/jfs/t1/143702/31/16654/116794/5fc6f541Edebf8a57/4138097748889987.png'
              />
              <View className='desc'>
                <View>
                  <Text className='nickname'>管理员</Text>
                  <Text className='department'>公卫科</Text>
                </View>
                <View className='organization'>
                  <Text>滨海市疾病预防控制中心</Text>
                </View>
              </View>
            </View>
            <Divider />
            <View className='footer'>
              <View>
                <Image src={AbilityImg} />
                <Text className='label'>能力认证：</Text>
                <Text className='labelValue'>55</Text>
              </View>
              <View>
                <Image src={MessageImg} />
                <Text className='label'>个人消息：</Text>
                <Text className='labelValue'>55</Text>
              </View>
            </View>
          </View>
        </View>

        <TodoList />

        <TaskList />
      </BasicLayout>
    </View>
  )
}
